Skip to content

test: raise line coverage - #58

Merged
roxblnfk merged 3 commits into
1.xfrom
test/coverage
Nov 20, 2026
Merged

roxblnfk merged 3 commits into
1.xfrom
test/coverage

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What was changed

  • Unit: the schema behaviors declare their listeners, ListenerProvider resolves them and the dispatcher runs them on a real OnCreate; the provider returns nothing for an unknown role or an event without listeners.
  • Feature: listener definitions of a missing class or without events are skipped; an uncallable getEventsList() method and a #[Listen] without its event raise errors.
  • Feature: RegistryModifier reuses an existing field of the same type and rejects one of another type; OptimisticLock rejects an unknown rule; a BaseModifier with no listener arguments declares the bare class.
  • Feature: a joined-table-inheritance entity dispatches the parent role's listeners on create and update.

Why?

Line coverage: local Unit + SQLite 89.5% → 97.8%; Codecov on 1.x 83.3% (82.7% on the repository page, which still reads the stale master branch). Part of the Codecov gap is not missing tests: CI collects coverage with pcov on PHP 8.5+, where a file that a suite never loads is reported with its executable lines from static analysis, and those lines (constructor signatures, inner lines of multi-line calls) differ from what pcov reports for executed code. Codecov merges the flags, so such lines counted as missed whenever the Unit suite never loaded the class. The Unit tests above load the listeners and the provider.

Review notes

  • Codecov (merged flags): 83.29% → 97.83% (74 → 9 missed lines, the 9 are isType()).

  • Bug, left in src: EventDrivenCommandGenerator::generateParentStoreCommand() always dispatches OnCreate for the parent roles, also on update. Updating a joined-table-inheritance child therefore rewrites the parent's createdAt (seen as UPDATE documents SET … created_at = <now>), and OnUpdate listeners of the parent never run. The new test does not assert created_at on update for that reason.

  • Suspected bug: the OptimisticLock attribute documents and exposes RULE_MANUAL, but render() throws Wrong rule \manual`` for it.

  • Unreachable: the deprecated protected RegistryModifier::isType() (9 lines) has no caller; RegistryModifier is @internal.

  • With pcov on PHP 8.5 in docker, Unit + SQLite merged the way Codecov does: 406/477 → 444/453; only isType() stays uncovered.

Checklist

  • Tested
    • Unit, SQLite and Regression/SQLite suites pass locally
    • Unit tests added

…d cover the listener errors

On PHP 8.5 the Unit report marked lines of the listeners and the provider as unexecuted that the database suites never report, so Codecov counted them as missed.

Assisted-By: Claude Opus 5.5 <[email protected]>
@roxblnfk
roxblnfk requested a review from a team November 20, 2026 19:59
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.83%. Comparing base (369a7b9) to head (ce8ee80).

Additional details and impacted files
@@             Coverage Diff             @@
##              1.x      #58       +/-   ##
===========================================
+ Coverage   83.29%   97.83%   +14.54%     
===========================================
  Files          20       20               
  Lines         443      416       -27     
===========================================
+ Hits          369      407       +38     
+ Misses         74        9       -65     
Flag Coverage Δ
mysql 97.11% <ø> (+8.65%) ⬆️
postgres 97.11% <ø> (+8.65%) ⬆️
sqlite 97.11% <ø> (+8.65%) ⬆️
sqlserver 97.11% <ø> (+8.65%) ⬆️
unit 32.45% <ø> (+25.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk
roxblnfk merged commit 277e925 into 1.x Nov 20, 2026
22 checks passed
@roxblnfk
roxblnfk deleted the test/coverage branch November 20, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant